package com.hooda.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.Date;

/**
 * @author zhangzp
 * @version 1.0
 * @date 2021/8/31
 */
@Controller
@RequestMapping("/demo")
public class DemoController {

    @RequestMapping("/hello1")
    public ModelAndView hello1() {
        // 封装数据和页面信息的 ModelAndView
        ModelAndView modelAndView = new ModelAndView();
        // addObject 向请求域中request.setAttribute("date", date)
        modelAndView.addObject("date", new Date());
        modelAndView.setViewName("success");
        return modelAndView;
    }
}
